#pragma once
#include "diplom.h"
#include "DElement.h"
#include "DLinkable.h"
#include "Dlink.h"
#include <vector>

enum DLE_EDIT_MODE
{
	DLE_EM_NONE,
	DLE_EM_PLACEELEMENT,
	DLE_EM_CONNECT_FIRST,
	DLE_EM_CONNECT_SECOND
};

class DLinkEditor: public wxWindow
{
	DLE_EDIT_MODE m_editMode;
	wxString m_parameter;
	Dlink *m_line;
	int m_currentSel;
	int m_firstConnectedId;
	DLinkable *m_linkable;
	wxArrayString m_listOfElems;
	enum SelectedType { ST_ELEMS, ST_LINKS, ST_NONE } m_selType;

public:
	DLinkEditor(wxWindow *parent);
	~DLinkEditor(void);

	DElement m_element;
	DElement m_lines;

	void OnPaint(wxPaintEvent &evt);
	void KeyDown(wxKeyEvent &event);
	void OnEraseBackground(wxEraseEvent &evt) {};
	void OnLeftDown(wxMouseEvent &evt);
	void OnMouseMove(wxMouseEvent &evt);
	void SetEditMode(DLE_EDIT_MODE md, wxString param);
	void UnsetEditMode();
	void UpdateListOfPlacedElements();

	wxArrayString GetListOfElements();
	void UpdateNumeration();
	void CLearData();

private:
	DECLARE_EVENT_TABLE()
};

